package com.redissession.demo.service;

import com.redissession.demo.dao.UserInfo;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

@Service
public class UserService {
  @Cacheable(value = "redis-key")
  public UserInfo getUserInfo(Long id, String sex, int age, String name) {
      System.out.println("无缓存时调用----数据库查询");
      return new UserInfo(id, sex, age, name);
  }
}

